package com.lzy.product.service.impl;

import com.lzy.framework.core.utils.DozerUtils;
import com.lzy.product.dao.AgentProtocolImageTextMapperExt;
import com.lzy.product.dtos.agent.AgentProtocolImageTextDto;
import com.lzy.product.entity.AgentProtocolImageText;
import com.lzy.product.service.AgentProtocolImageTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AgentProtocolImageTextServiceImpl implements AgentProtocolImageTextService {

    @Autowired
    private AgentProtocolImageTextMapperExt agentProtocolImageTextMapperExt;

    @Override
    public Long insert(AgentProtocolImageTextDto dto) {
        AgentProtocolImageText agentProtocolImageText = DozerUtils.map(dto, AgentProtocolImageText.class);
        return agentProtocolImageTextMapperExt.insertSelective(agentProtocolImageText) > 0 ? agentProtocolImageText.getId() : 0;
    }

    @Override
    public Boolean update(AgentProtocolImageTextDto dto) {
        return agentProtocolImageTextMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto, AgentProtocolImageText.class)) > 0;
    }

    @Override
    public Boolean delete(Long id) {
        return null;
    }

    @Override
    public Boolean remove(Long id) {
        return null;
    }

    @Override
    public AgentProtocolImageTextDto findById(Long id) {
        return DozerUtils.map(agentProtocolImageTextMapperExt.selectByPrimaryKey(id), AgentProtocolImageTextDto.class);
    }

    @Override
    public List<AgentProtocolImageTextDto> query(AgentProtocolImageTextDto dto) {
        return null;
    }

    @Override
    public List<AgentProtocolImageTextDto> selectByProtocolId(Long protocolId) {
        return agentProtocolImageTextMapperExt.selectByProtocolId(protocolId);
    }

    @Override
    public Boolean deleteByProtocolId(Long protocolId) {
        return agentProtocolImageTextMapperExt.deleteByProtocolId(protocolId);
    }

    @Override
    public List<AgentProtocolImageTextDto> selectByProtocolIdAndType(Long protocolId, Integer type) {
        return agentProtocolImageTextMapperExt.selectByProtocolIdAndType(protocolId, type);
    }
}
